package tests;
import static org.junit.Assert.*;

import mailsystem.Message;
import mailsystem.MessageQueue;

import org.junit.Test;



public class MessageQueueTest {

	@Test
	public void testRemove() {
		MessageQueue queue = new MessageQueue();
		
		queue.add(new Message("1", 0, false));
		queue.add(new Message("2", 0, false));
		queue.add(new Message("3", 0, false));
		queue.add(new Message("4", 0, false));
		Message msg = queue.remove();
		assertEquals("1", msg.getText());
	}

	@Test
	public void testAdd() {
		MessageQueue queue = new MessageQueue();
		
		queue.add(new Message("1", 0, false));
		queue.add(new Message("2", 0, false));
		queue.add(new Message("3", 0, false));
		queue.add(new Message("4", 0, false));
		Message msg = queue.remove();
		assertEquals("1", msg.getText());
	}

	@Test
	public void testSize() {
		MessageQueue queue = new MessageQueue();
		
		queue.add(new Message("1", 0, false));
		queue.add(new Message("2", 0, false));
		queue.add(new Message("3", 0, false));
		queue.add(new Message("4", 0, false));
		
		assertEquals(4, queue.size());
	}

	@Test
	public void testPeek() {
		MessageQueue queue = new MessageQueue();
		
		queue.add(new Message("1", 0, false));
		queue.add(new Message("2", 0, false));
		queue.add(new Message("3", 0, false));
		queue.add(new Message("4", 0, false));
		Message msg = queue.peek();
		assertEquals("1", msg.getText());
	}

}
